/*
 * @Author: TTangZH <your.email@example.com>
 * @Date: 2025-05-31
 * @Description: AS5600磁编码器接口
 */
#ifndef __AS5600_H
#define __AS5600_H

#include "i2c/i2c.h"

typedef union
{
    uint8_t data8[2];
    uint16_t data16;
}byte8_to_byte16;

typedef enum
{
/* set i2c address */ 
  _ams5600_Address = 0x36,
  _zmco = 0x00,
  _zpos_h = 0x01,
  _zpos_l = 0x02,
  _mpos_h = 0x03,
  _mpos_l = 0x04,
  _mang_h = 0x05,
  _mang_l = 0x06,
  _conf_h = 0x07,    
  _conf_l = 0x08,
  _raw_ang_h = 0x0c,
  _raw_ang_l = 0x0d,
  _ang_h = 0x0e,
  _ang_l = 0x0f,
  _stat = 0x0b,
  _agc = 0x1a,
  _mag_h = 0x1b,
  _mag_l = 0x1c,
  _burn = 0xff
}as5600_registers_t;

uint16_t read_raw_angle(void);
uint8_t detect_magnet(void);

#endif

